package com.ruoyi.miniapp.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.miniapp.domain.MiniChildInfo;
import com.ruoyi.miniapp.mapper.MiniChildInfoMapper;
import com.ruoyi.miniapp.service.IMiniChildInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 孩子信息Service业务层处理
 * 
 * @author duantao
 * @date 2025-09-19
 */
@Service
public class MiniChildInfoServiceImpl implements IMiniChildInfoService
{
    @Autowired
    private MiniChildInfoMapper miniChildInfoMapper;

    /**
     * 查询孩子信息
     * 
     * @param childId 孩子信息主键
     * @return 孩子信息
     */
    @Override
    public MiniChildInfo selectMiniChildInfoByChildId(Long childId)
    {
        return miniChildInfoMapper.selectMiniChildInfoByChildId(childId);
    }

    /**
     * 查询孩子信息列表
     * 
     * @param miniChildInfo 孩子信息
     * @return 孩子信息
     */
    @Override
    public List<MiniChildInfo> selectMiniChildInfoList(MiniChildInfo miniChildInfo)
    {
        return miniChildInfoMapper.selectMiniChildInfoList(miniChildInfo);
    }

    /**
     * 新增孩子信息
     * 
     * @param miniChildInfo 孩子信息
     * @return 结果
     */
    @Override
    public int insertMiniChildInfo(MiniChildInfo miniChildInfo)
    {
        miniChildInfo.setCreateTime(DateUtils.getNowDate());
        int childId = miniChildInfoMapper.insertMiniChildInfo(miniChildInfo);
        return childId;
    }

    /**
     * 修改孩子信息
     * 
     * @param miniChildInfo 孩子信息
     * @return 结果
     */
    @Override
    public int updateMiniChildInfo(MiniChildInfo miniChildInfo)
    {
        miniChildInfo.setUpdateTime(DateUtils.getNowDate());
        return miniChildInfoMapper.updateMiniChildInfo(miniChildInfo);
    }

    /**
     * 批量删除孩子信息
     * 
     * @param childIds 需要删除的孩子信息主键
     * @return 结果
     */
    @Override
    public int deleteMiniChildInfoByChildIds(Long[] childIds)
    {
        return miniChildInfoMapper.deleteMiniChildInfoByChildIds(childIds);
    }

    /**
     * 删除孩子信息信息
     * 
     * @param childId 孩子信息主键
     * @return 结果
     */
    @Override
    public int deleteMiniChildInfoByChildId(Long childId)
    {
        return miniChildInfoMapper.deleteMiniChildInfoByChildId(childId);
    }
}
